/*
 *  Copyright 2004 Blandware (http://www.blandware.com)
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.blandware.atleap.webapp.form.core;

import org.apache.struts.action.ActionMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>Form bean for content resource with type image
 * </p>
 * <p><a href="ImageForm.java.html"><i>View Source</i></a></p>
 * <p/>
 *
 * @author Andrey Grebnev <a href="mailto:andrey.grebnev@blandware.com">&lt;andrey.grebnev@blandware.com&gt;</a>
 * @version $Revision: 1.10 $ $Date: 2008/04/29 17:52:51 $
 * @struts.form name="imageForm"
 */
public class ImageForm extends ContentImageForm {

    /**
     * Width to which to scale
     */
    protected String scaleWidth = "0";
    /**
     * Height to which to scale
     */
    protected String scaleHeight = "0";
    /**
     * Whether to scale
     */
    protected boolean scale = false;

    /**
     * Returns scale width.
     *
     * @return scale width
     */
    public String getScaleWidth() {
		return scaleWidth;
	}

	/**
     * Sets scale width.
     *
     * @param scaleWidth width to set
	 * @struts.validator type="integer"
	 * @struts.validator-args arg0resource="core.contentResource.form.scaleWidth"
	 */
	public void setScaleWidth(String scaleWidth) {
		this.scaleWidth = scaleWidth;
	}

    /**
     * Returns scale height.
     *
     * @return scale height
     */
	public String getScaleHeight() {
		return scaleHeight;
	}

	/**
     * Sets scale height.
     *
     * @param scaleHeight height to set
	 * @struts.validator type="integer"
	 * @struts.validator-args arg0resource="core.contentResource.form.scaleHeight"
	 */
	public void setScaleHeight(String scaleHeight) {
		this.scaleHeight = scaleHeight;
	}

    /**
     * Returns whether to scale.
     *
     * @return whether to scale
     */
    public boolean isScale() {
		return scale;
	}

    /**
     * Sets whether to scale.
     *
     * @param scale whether to scale
     */
    public void setScale(boolean scale) {
		this.scale = scale;
	}

    /**
	 * Resets all properties to their default values
	 *
	 * @param mapping The ActionMapping used to select this instance
	 * @param request The non-http request we are proceeding
	 */
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		this.scaleWidth = "0";
		this.scaleHeight = "0";
		this.scale = false;
	}

}